import Component from "../component";

class FloatingZone extends Component {
  value = {
    floating_zone_switch: false,
    floating_zone_image_id: '',
    floating_zone_name: '',
    floating_zone_desc: '',
    floating_zone_button_text: '',
    floating_zone_type: 'FLOATING_ZONE_TYPE_IMAGE_TEXT',
    floating_zone_single_image_id: '',

  }
  query() {
    if (!this.value.floating_zone_switch) return null;
    const query = {
      floating_zone_switch: this.value.floating_zone_switch,
      floating_zone_image_id: "" + (this.value.floating_zone_image_id || ""),
      floating_zone_name: this.value.floating_zone_name || '',
      floating_zone_desc: this.value.floating_zone_desc || '',
      floating_zone_button_text: this.value.floating_zone_button_text || '',
      floating_zone_type: this.value.floating_zone_type || 'FLOATING_ZONE_TYPE_IMAGE_TEXT',
      // floating_zone_single_image_id: this.value.floating_zone_single_image_id || '',
    }
    if (this.value.floating_zone_type === 'FLOATING_ZONE_TYPE_IMAGE_TEXT') {
      return query;
    }
    return {
      floating_zone_switch: this.value.floating_zone_switch,
      floating_zone_type: this.value.floating_zone_type || 'FLOATING_ZONE_TYPE_IMAGE_TEXT',
      floating_zone_single_image_id: "" + (this.value.floating_zone_single_image_id || '')
    }
  }

}

export default FloatingZone;
